<?php

namespace app\app\controller;

use app\BaseController;
use app\app\model\ProjectRuleModel;


class ProjectRule extends BaseController
{
    public function index()
    {
        $data = $this->request->param();
        $page_size = input('pageSize', '20');
        $where = "a.type = '" . $data['type'] . "'";
        if (!empty($data['fileName'])) {
            $where .= " AND a.wj_name like '%" . $data['fileName'] . "%'";
        }
        if (!empty($data['operName'])) {
            $where .= " AND a.oper_name like '%" . $data['operName'] . "%'";
        }
        if (!empty($data['keyWord'])) {
            $where .= " AND a.key_word like '%" . $data['keyWord'] . "%'";
        }
        if (!empty($data['fwTime'])) {
            $where .= " AND a.fw_time " . $data['fwTime'];
        }
        $list = ProjectRuleModel::alias('a')
            ->field('a.*,b.file_name,b.file_path')
            ->leftjoin('sys_file_info b', 'b.file_id = a.file_id')
            ->where($where)->paginate($page_size);
        $this->success('success', $list);
    }


}
